<template>
	<view class="main-cont box box-tb">
		<view class="stu-main" v-if="stuList.length !=0">
			<view class="list box box-align-center" v-for="(item, index) in stuList" :key="index" @click="goXq()">
				<view class="sort box box-align-center box-pack-center" v-if="index<=2">
					<u-image src="@/static/home/sort_1.png" width="38rpx" height="45rpx" v-if="index == 0"></u-image>
					<u-image src="@/static/home/sort_2.png" width="38rpx" height="45rpx" v-if="index == 1"></u-image>
					<u-image src="@/static/home/sort_3.png" width="38rpx" height="45rpx" v-if="index == 2"></u-image>
				</view>
				<view class="sort sort box box-align-center box-pack-center" v-if="index>2">{{parseInt(index)+1}}</view>
				<view class="name box box-align-center box-pack-start">
					<u-avatar :src="item.icon" mode="circle" size="72"></u-avatar>
					<view class="ml10 box box-tb box-align-start">
						<view class="">
							{{item.name}}
						</view>
						<view class="">
							{{item.acc}}
						</view>
					</view>
				</view>
				<view class="score">{{item.num}}</view>
			</view>
		</view>
		<no-data title="暂无学生" v-else class="stu-main"></no-data>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currSchool:uni.getStorageSync('currSchool'),
				customStyle: {
					color: "#fff",
					width: "147rpx",
					height: "46rpx",
					background: "#626BF1",
					fontSize: "24rpx"
				},
				thStyle: {
					backgroundColor: "#fff"
				},
				classList: [],
				classTitle: '',
				classValue: '',
				stuList: [],
				typeValue: 1,
				typeTitle: '',
				typeList: [{
						label: '按总分',
						value: 1,
					},
					{
						label: '按课程',
						value: 2,
					},
					{
						label: '按实践',
						value: 3,
					}
				],
			}
		},
		onLoad(opt) {
			this.xn = opt.xn;
			this.xq = opt.xq;
			this.zydm = opt.zydm;
			this.listTime();
		},
		methods: {
			listTime() {
				let opts = {
					url: '/ycert/xqbgTime',
					method: 'post'
				};
				let params = {
					xn:this.xn,
					xq:this.xq,
					zydm:this.zydm,
					schoolid:this.currSchool.id
				};
				this.$api.post(opts, params).then(res => {
					for(let i = 0;i<res.list.length;i++){
						res.list[i].num = Math.floor(res.list[i].num/60) + "小时" + (res.list[i].num%60) + "分" ;
					}
					this.stuList = res.list;
				})
			},
			goXq(){
				uni.navigateTo({
					url: "/team/my/xq"
				})
			}

		}
	}
</script>

<style scoped lang="scss">
	.main-cont {
		width: 100%;
		height: 100%;
		background-color: #fff;


		.bgcfff {
			background-color: #fff;
		}

		.bottom {
			width: 100%;
		}

		.stu-main {
			// padding: 20rpx 50rpx;
			margin: 20rpx 14rpx;
			width: 722rpx;
			height: 100%;
			overflow-y: auto;
			background-color: #fff;
		}

		.list {
			padding: 0 47rpx 0 26rpx;
			margin: 34rpx 14rpx;
			width: 722rpx;
			height: 126rpx;
			background: #FFFFFF;
			border-bottom: 2rpx solid #F0F1F8;
		}


		.check {
			width: 100rpx;
			text-align: center;
		}

		.sort {
			width: 60rpx;
			text-align: center;
		}

		.name {
			padding-left: 40rpx;
			text-align: left;
			width: 350rpx;
		}

		.score {
			text-align: right;
			width: 120rpx;
		}
	}
</style>
